package com.xhd.server;

import java.util.Hashtable;

import com.xhd.base.session.Session;
import com.xhd.base.session.SessionUserInfo;
import com.xhd.base.util.Date;
import com.xhd.base.util.xBaseObj;
import com.xhd.exception.XException;
import com.xhd.servlet.ClientAction;

public class ProcessHandle {
	private int jm111 = 0;
	  private long jm216 = 0L;
	  private xBaseObj jm114 = null;
	  private Session jm119 = null;
	  private ClientAction jm217;

	  public int getId()
	  {
	    return this.jm111;
	  }

	  public void setId(int paramInt)
	  {
	    this.jm111 = paramInt;
	    this.jm216 = System.currentTimeMillis();
	    this.jm114 = null;
	    this.jm119 = null;
	  }

	  public void setBizObj(xBaseObj paramxBaseObj)
	  {
	    if (this.jm114 != null)
	    {
	      if (paramxBaseObj == null)
	        return;
	      paramxBaseObj.setParent(this.jm114);
	    }
	    else
	    {
	      this.jm114 = paramxBaseObj;
	      if ((paramxBaseObj == null) || (this.jm119 == null) || (paramxBaseObj.getSession() != null))
	        return;
	      paramxBaseObj.setSession(this.jm119);
	    }
	  }

	  public xBaseObj getBizObj()
	  {
	    return this.jm114;
	  }

	  public Session getSession()
	  {
	    return this.jm119;
	  }

	  public void setSession(Session paramSession)
	  {
	    this.jm119 = paramSession;
	  }

	  public long getOpenTime()
	  {
	    return this.jm216;
	  }

	  public ClientAction getAction()
	  {
	    return this.jm217;
	  }

	  public void setAction(ClientAction paramClientAction)
	  {
	    this.jm217 = paramClientAction;
	  }

	  public Hashtable getProcessInfo(boolean paramBoolean)
	    throws XException
	  {
	    Hashtable localHashtable = null;
	    SessionUserInfo localSessionUserInfo;
	    if (paramBoolean)
	    {
	      if (this.jm114 != null)
	      {
	        localHashtable = this.jm114.toHashtable();
	        if (this.jm114.getDao() != null)
	          localHashtable.put("DC-INFO", this.jm114.getDao().getUseInfo(true));
	      }
	      else
	      {
	        localHashtable = new Hashtable(4);
	        if (this.jm119 != null)
	        {
	          localSessionUserInfo = this.jm119.getUserInfo();
	          if (localSessionUserInfo != null)
	            localHashtable.put("username", localSessionUserInfo.getUserId());
	        }
	      }
	      if (this.jm119 != null)
	        localHashtable.put("cpcsessionid", this.jm119.getId());
	    }
	    else
	    {
	      localHashtable = new Hashtable(8);
	      if (this.jm114 != null)
	      {
	        localSessionUserInfo = this.jm114.getUserInfo();
	        if (localSessionUserInfo != null)
	          localHashtable.put("username", localSessionUserInfo.getUserId());
	        if (this.jm114.getDao() != null)
	          localHashtable.put("DC-INFO", this.jm114.getDao().getUseInfo(false));
	      }
	      else if (this.jm119 != null)
	      {
	        localSessionUserInfo = this.jm119.getUserInfo();
	        if (localSessionUserInfo != null)
	          localHashtable.put("username", localSessionUserInfo.getUserId());
	      }
	    }
	    localHashtable.put("processid", String.valueOf(this.jm111));
	    localHashtable.put("starttime", new Date(this.jm216));
	    if (this.jm217 != null)
	    {
	      localHashtable.put("classname", this.jm217.getServiceName());
	      localHashtable.put("actionname", this.jm217.getMethodName());
	      localHashtable.put("client-ip", this.jm217.getClientIP());
	    }
	    return localHashtable;
	  }
}
